<template>
  <router-link to="/business/base/profile">
    <div class="myBox">
      <div class="L"><img :src="business.avatar_cdn" /></div>
      <div class="C">
        <div class="tit">
          {{ business.nickname ? business.nickname : business.mobile_text }}
        </div>
        <div class="sub" v-if="business.nickname">
          {{ business.mobile_text }}
        </div>
      </div>
      <div class="R"><img src="/assets/images/go.png" /></div>
    </div>
  </router-link>
  <div class="clear"></div>
  <div class="allkbox"></div>
  <router-link to="/business/base/profile">
    <div class="myboxcon">
      <p>基本资料</p>
      <img src="/assets/images/go.png" />
    </div>
  </router-link>
  <router-link
    to="/business/base/email"
    v-if="business.email && business.auth != 1"
  >
    <div class="myboxcon">
      <p>邮箱认证（需通过邮箱接收快递单号）</p>
      <img src="/assets/images/go.png" />
    </div>
  </router-link>
  <router-link to="/business/address/index">
    <div class="myboxcon">
      <p>我的收货地址</p>
      <img src="/assets/images/go.png" />
    </div>
  </router-link>
  <router-link to="/business/base/collect">
    <div class="myboxcon">
      <p>我的收藏</p>
      <img src="/assets/images/go.png" />
    </div>
  </router-link>
  <router-link to="/product/order/index">
    <div class="myboxcon">
      <p>我的订单</p>
      <img src="/assets/images/go.png" />
    </div>
  </router-link>
  <!-- <a href="http://47.120.65.136/home/business/pay/pay.html"> -->
  <a href="http://47.120.65.136/home/business/pay/pay.html">
  <div class="myboxcon">
    <p>充值</p>
    <img src="/assets/images/go.png" />
  </div>
</a>  
  <div class="myboxcon" @click="onLogout">
    <p>退出账号</p>
    <img src="/assets/images/go.png" />
  </div>

  <!-- \ No newline at end of file -->
  <div class="clear"></div>
  <div class="h54"></div>
  <div class="clear"></div>

  <Footer />
</template>

<script setup>
import Footer from "components/common/Footer.vue";
import { reactive, getCurrentInstance, ref } from "vue";

const { proxy } = getCurrentInstance();
const business = reactive(proxy.$cookies.get("business") ?? {});
const onLogout = () => {
  proxy
    .$showConfirmDialog({
      title: "退出账号",
      message: "确认退出当前账号？",
    })
    .then((result) => {
      proxy.$showNotify({
        type: "success",
        message: "退出成功",
        duration: 2000,
        onClose: () => {
          proxy.$cookies.remove("business");

          proxy.$router.push("/business/base/login");
        },
      });
    })
    .catch((err) => {});
};

</script>
